//
//  RACSubjectBVC.m
//  ReactiveObjCDemo
//
//  Created by xth on 2017/12/7.
//  Copyright © 2017年 xth. All rights reserved.
//

#import "RACSubjectBVC.h"

@interface RACSubjectBVC ()

@end

@implementation RACSubjectBVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 50)];
    button.backgroundColor = [UIColor orangeColor];
    [button setTitleColor:[UIColor whiteColor] forState:0];
    [button setTitle:@"点我BB" forState:0];
    
    [self.view addSubview:button];
    
    [[button rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        
        if (self.delegateSignal) {
            [self.delegateSignal sendNext:@"点我bb"];
            [self.delegateSignal sendCompleted];
            [self.navigationController popViewControllerAnimated:YES];
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
